package com.guoheng.safe.sys.controller;

import com.guoheng.safe.common.base.Result;
import com.guoheng.safe.sys.dto.IdDTO;
import com.guoheng.safe.sys.dto.basicinfo.StorageTankAreaAddDTO;
import com.guoheng.safe.sys.dto.basicinfo.StorageTankAreaPageDTO;
import com.guoheng.safe.sys.dto.basicinfo.StorageTankAreaUpdateDTO;
import com.guoheng.safe.sys.service.StorageTankAreaService;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 类功能描述:　BasicController
 *
 * @author Eternal
 * @date 2019-56-15 14:56
 */
@RestController
@Validated
@Api(value = "储罐区信息")
public class StorageTankAreaController {

    @Resource
    StorageTankAreaService storageTankAreaService;

    @PostMapping(value = "basic/storageTank/add")
    public Result addStorageTankArea(@RequestBody @Valid StorageTankAreaAddDTO storageTankAreaAddDTO){
        return storageTankAreaService.addStorageTankArea(storageTankAreaAddDTO);
    }

    @PostMapping(value = "basic/storageTank/update")
    public Result updateStorageTankArea(@RequestBody @Valid StorageTankAreaUpdateDTO storageTankAreaUpdateDTO){
        return storageTankAreaService.updateStorageTankArea(storageTankAreaUpdateDTO);
    }

    @PostMapping(value = "basic/storageTank/delete")
    public Result deleteStorageTankArea(@RequestBody @Valid IdDTO idDTO){
        return storageTankAreaService.deleteStorageTankArea(idDTO);
    }

    @PostMapping(value = "basic/storageTank/query")
    public Result getStorageTankArea(@RequestBody @Valid IdDTO idDTO){
        return storageTankAreaService.getStorageTankArea(idDTO);
    }

    @PostMapping(value = "basic/storageTank/page")
    public Result getStorageTankAreas(@RequestBody @Valid StorageTankAreaPageDTO pageDTO){
        return storageTankAreaService.getStorageTankAreaPage(pageDTO);
    }

}
